package classes {
	/**
	 * 
	 * @author dimetrix
	 * 
	 */	
	public class PrettyPrint {
		
		public function PrettyPrint() {
		}
		
		/**
		 * 
		 * @param o
		 * @return 
		 * 
		 */		
		public static function prettyPrint(o:Object):String {
			return parse(o);
		}
		
		// ---
			
		/**
		 * 
		 * @param o
		 * @param level
		 * @param output
		 * @param max
		 * @return 
		 * 
		 */		
		private static function parse(o:*, level:int = 1, output:String = "", max:uint = 100):String {
			var tabs:String = new Array(level).join("   "), child:*;
			
			for (child in o) {  
				output += tabs + child + ": " + (o[child] == "[object Object]" ? "" : o[child]) + "\n" + parse(o[child], level + 1);  
			}  
			
			return level > max ? "" : output;  
		}
	}
}